﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;

namespace ModalDownload.Models
{
    public class AdminModels
    {
    }

    public class AdminLoginModel
    {
        [Required]
        [Display(Name = "用户名")]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(Name = "密码")]
        public string Password { get; set; }

        public static bool Login(AdminLoginModel model)
        {
            if (SQL_MS.myTable(string.Format("select 1 from [user] where isadmin=1 and username='{0}' and password='{1}'", model.UserName, model.Password), CommandType.Text, null).Rows.Count > 0)
                return true;
            return false;
        }
    }
}